<%--
  Created by IntelliJ IDEA.
  User: 15154
  Date: 2020/10/10
  Time: 15:51
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html class="loginHtml">
<head>
    <meta charset="utf-8">
    <title>登录--layui后台管理模板 2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="icon" href="resources/favicon.ico">
    <link rel="stylesheet" href="resources/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="resources/css/public.css" media="all" />
</head>

<body class="loginBody" >
<form class="layui-form" id="loginFrm" method="post" action="register">
    <div style="width: 50px;height: 50px" class="login_face"><img src="resources/images/face.jpg" class="userAvatar"></div>
    <div class="layui-form-item input-item">
        <label for="number">学号</label>
        <input type="text" placeholder="请输入学号" autocomplete="off" id="number" name="stuNumber" class="layui-input" lay-verify="required">
    </div>

    <div class="layui-form-item input-item">
        <label for="username">姓&nbsp;&nbsp;&nbsp;&nbsp;名</label>
        <input type="text" placeholder="请输入姓名" autocomplete="off" id="username" name="stuName" class="layui-input" lay-verify="required">
    </div>

    <div class="layui-form-item input-item">
        <label for="password">密&nbsp;&nbsp;&nbsp;&nbsp;码</label>
        <input type="password" placeholder="请输入密码" autocomplete="off" id="password" name="passWord" class="layui-input" lay-verify="required">
    </div>

    <div class="layui-form-item">
        <%--<div class="layui-input-block">--%>
            <%--<select id="buildNumber" name="buildNumber">--%>
                <%--<option value=""></option>--%>
            <%--</select>--%>
        <%--</div>--%>
        <%--<label>请选择楼层</label>--%>
            <select id="buildId" name="buildNumber" lay-verify="required"  lay-filter="business" class="select">
                <option value="">请选择楼栋数</option>
            </select>
    </div>

    <div class="layui-form-item">
        <input type="radio" name="sex" value="0" title="男" checked="">
        <input type="radio" name="sex" value="1" title="女">
    </div>

    <div class="layui-form-item">
        <button class="layui-btn layui-block" lay-filter="login" lay-submit>注册</button>
    </div>

</form>
<script type="text/javascript" src="resources/layui/layui.js"></script>
<script type="text/javascript" src="resources/js/cache.js"></script>
<script type="text/javascript">
    layui.use(['form','layer','jquery'],function(){
        var form = layui.form,
            //layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery;

        //实现下拉列表从数据库中读取数据
        $.get({
            url:'/build/findAllBuildNumber',
            dataType:'json',
            success:function (result) {
                var html = "";
                for (var i = 0; i < result.length; i++) {
                    html+="<option value='"+result[i].buildNumber+"'>"+result[i].buildNumber+"</option>"
                }
                $("[name='buildNumber']").append(html);
                form.render("select");
            }
        });

        //登录按钮
        form.on("submit(login)",function(data){
            $(this).text("注册中...").attr("disabled","disabled").addClass("layui-disabled");
            form.val("login",data);
            setTimeout(function(){
                $("#loginFrm").submit();
            },1000);
            return false;
        });

        //表单输入效果
        $(".loginBody .input-item").click(function(e){
            e.stopPropagation();
            $(this).addClass("layui-input-focus").find(".layui-input").focus();
        });
        $(".loginBody .layui-form-item .layui-input").focus(function(){
            $(this).parent().addClass("layui-input-focus");
        });
        $(".loginBody .layui-form-item .layui-input").blur(function(){
            $(this).parent().removeClass("layui-input-focus");
            if($(this).val() != ''){
                $(this).parent().addClass("layui-input-active");
            }else{
                $(this).parent().removeClass("layui-input-active");
            }
        });
    })

</script>
</body>
</html>
